import com.alibaba.excel.EasyExcel;
import listener.ReadListener;
import org.junit.Test;
import pojo.Student;


import java.util.ArrayList;
import java.util.Date;

public class test1 {

    //Excle 写的操作
    @Test
    public void t1(){
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student(1L,"张三",new Date()));
        list.add(new Student(2L,"李四",new Date()));
        list.add(new Student(3L,"王五",new Date()));

        String fileName="E:/桌面文件/自我练习/student.xlsx";

        EasyExcel.write(fileName,Student.class).sheet("模板").doWrite(list);
    }

    @Test
    public void t2(){
        String fileName = "E:/桌面文件/自我练习/student.xlsx";
        // 这里 需要指定读用哪个class去读，然后读取第一个sheet 文件流会自动关闭
        EasyExcel.read(fileName, Student.class, new ReadListener()).sheet().doRead();
    }
}
